package cn.coders.net.service.impl;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

import cn.coders.net.dao.BaseDao;
import cn.coders.net.service.BaseService;


/**
 * Service实现类 - Service实现类基类
 */

public class BaseServiceImpl<T, PK extends Serializable> implements BaseService<T, PK> {

    private BaseDao<T, PK> baseDao;


    public BaseDao<T, PK> getBaseDao() {
        return baseDao;
    }


    public void setBaseDao(BaseDao<T, PK> baseDao) {
        this.baseDao = baseDao;
    }


    public T get(PK id) {
        return baseDao.get(id);
    }


    public T load(PK id) {
        return baseDao.load(id);
    }


    public List<T> get(PK[] ids) {
        return baseDao.get(ids);
    }


    public T get(String propertyName, Object value) {
        return baseDao.get(propertyName, value);
    }


    public T get(Map<String, Object> propertiesMap) {
        return baseDao.get(propertiesMap);
    }


    public List<T> getList(String propertyName, Object value) {
        return baseDao.getList(propertyName, value);
    }


    public List<T> getAll() {
        return baseDao.getAll();
    }


    public Long getTotalCount() {
        return baseDao.getTotalCount();
    }


    public Long getTotalCount(String propertyName, Object value) {
        return baseDao.getTotalCount(propertyName, value);
    }


    public boolean isUnique(String propertyName, Object oldValue, Object newValue) {
        return baseDao.isUnique(propertyName, oldValue, newValue);
    }


    public boolean isExist(String propertyName, Object value) {
        return baseDao.isExist(propertyName, value);
    }


    public PK save(T entity) {
        return baseDao.save(entity);
    }


    public void update(T entity) {
        baseDao.update(entity);
    }


    public void merge(T entity) {
        baseDao.merge(entity);
    }


    public void delete(T entity) {
        baseDao.delete(entity);
    }


    public void delete(PK id) {
        baseDao.delete(id);
    }


    public void delete(PK[] ids) {
        baseDao.delete(ids);
    }


    public void flush() {
        baseDao.flush();
    }


    public void clear() {
        baseDao.clear();
    }


    public void evict(Object object) {
        baseDao.evict(object);
    }


    // public Pager findByPager(Pager pager) {
    // return baseDao.findByPager(pager);
    // }
    //
    //
    // public Pager findByPager(Pager pager, DetachedCriteria detachedCriteria)
    // {
    // return baseDao.findByPager(pager, detachedCriteria);
    // }

    public Double getSumTotal(String propertySum, String propertyName, Object value) {
        return baseDao.getSumTotal(propertySum, propertyName, value);
    }


    public Double getSumTotal(String propertySum) {
        return baseDao.getSumTotal(propertySum);
    }


    public Long getTotalCountGroupByProerty(String groupByName) {
        return baseDao.getTotalCountGroupByProerty(groupByName);
    }


    public Long getTotalCount(String propertyName, Object value, String whereName, Object whereObject) {
        return baseDao.getTotalCount(propertyName, value, whereName, whereObject);
    }


    public List<T> getNoList(String propertyName, Object value) {
        return baseDao.getNoList(propertyName, value);
    }


    public List<T> getNoList(Map<String, Object> propertyMap) {
        // TODO Auto-generated method stub
        return baseDao.getNoList(propertyMap);
    }


    public List<T> getList(Map<String, Object> propertyMap) {
        // TODO Auto-generated method stub
        return baseDao.getList(propertyMap);
    }


    public T like(String propertyName, Object value) {
        // TODO Auto-generated method stub
        return baseDao.like(propertyName, value);
    }


    public List<T> find(Class object, String filedName, String whereStr, String orderbyStr, String groupByStr) {
        return baseDao.find(object, filedName, whereStr, orderbyStr, groupByStr);
    }


    // public <T> List<T> listObjectByPageInfor(Class<T> object, String
    // filedName, String whereStr,
    // String orderBystr, String groupByStr, PageInfo pageInfor) {
    // return baseDao.listObjectByPageInfor(object, filedName, whereStr,
    // orderBystr, groupByStr, pageInfor);
    // }

    public Long getTotalCount(Map<String, Object> propertyMap) {
        // TODO Auto-generated method stub
        return baseDao.getTotalCount(propertyMap);
    }


    public List findBySql(String sql) {
        // TODO Auto-generated method stub
        return null;
    }


    public int findTotalSQL(String hql) {
        // TODO Auto-generated method stub
        return 0;
    }

    /*
     * (non-Javadoc)
     * 
     * @see
     * cn.coders.net.service.BaseService#listObjectByPageInfor(java.lang.Class,
     * java.lang.String, java.lang.String, java.lang.String, java.lang.String,
     * cn.coders.net.service.PageInfo)
     */
    // @Override
    // public <T> List<T> listObjectByPageInfor(Class<T> object, String
    // filedName, String whereStr,
    // String orderBystr, String groupByStr, PageInfo pageInfor) {
    // // TODO Auto-generated method stub
    // return null;
    // }

    //
    // public PageInfo findByPageInfo(PageInfo pager) {
    // return baseDao.findByPageInfo(pager);
    // }
    //
    //
    // public PageInfo findByPageInfo(PageInfo pager, DetachedCriteria
    // detachedCriteria) {
    // return baseDao.findByPageInfo(pager, detachedCriteria);
    // }

}
